import { ArrResult } from '/#/axios';
import { RequestEnum } from '/@/enums/httpEnum';
import { defHttp } from '/@/utils/http/axios';

enum URL {
  ChoiceField = '/core/choicefield',
}

/**
 * @description 选项字段类型
 * @export
 * @interface ChoiceFieldResult
 */
export interface ChoiceFieldResult {
  name: string;
  value: any;
}

export class ChoiceFieldApi {
  public list(app: string, cls: string, field: string) {
    return defHttp.request<ArrResult<ChoiceFieldResult>>({
      url: `${URL.ChoiceField}/${app}/${cls}/${field}`,
      method: RequestEnum.GET,
    }) as Promise<ArrResult<ChoiceFieldResult>>;
  }
}

export const choiceFieldApi = new ChoiceFieldApi();
